﻿using SailHero.Soft.ESB.Communication.ClientAndServer.Communication.EndPoints;
using SailHero.Soft.ESB.Communication.ClientAndServer.Server;

namespace SailHero.Soft.ESB.Communication.Services.Service
{
    /// <summary>
    /// This class is used to build Service applications.
    /// </summary>
    public static class ServiceBuilder
    {
        /// <summary>
        /// Creates a new SailHero.Soft.ESB Service application using an EndPoint.
        /// </summary>
        /// <param name="endPoint">EndPoint that represents address of the service</param>
        /// <returns>Created SailHero.Soft.ESB service application</returns>
        public static IServiceApplication CreateService(ESBEndPoint endPoint)
        {
            return new ServiceApplication(ServerFactory.CreateServer(endPoint));
        }
    }
}
